// pages/my/vip/components/bulletFrameBox.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    getStaffList(){
      let shopId=wx.getStorageSync('shopId')
      Controllers.getStaffList({shopId:shopId}).then(res=>{
        res.data.unshift({id:''})
        this.setData({
          staffList:res.data
        })
      })
    },


//选择员工
selectStaff(e) {
  let index = e.currentTarget.dataset.index
  console.log(e)
  if (index === this.data.selectIndex) {
    this.setData({
      selectIndex: "",
      staffId: "",
      staffName: ""
    })
  } else {
    this.setData({
      selectIndex: index,
      staffId: this.data.staffList[index].id,
      staffName: this.data.staffList[index].nick
    })
  }
},

// //确定员工
// defineStaff(){
//   if(this.data.selectIndex||this.data.selectIndex===0){
//     this.setData({
//       staffId:this.data.list[this.data.selectIndex].id,
//       staffName:this.data.list[this.data.selectIndex].nick
//     })
//   }
// },
// 隐藏弹框
hideModal: function () {
  this.setData({
    showModalStatus: false,
    selectIndex: "",
    staffId: "",
    staffName: ""
  })
},
//跳转员工详情
selectStaffDetail(e) {
  let index = e.currentTarget.dataset.index
  if (index == 0) return
  let value = this.data.staffList[index]
  wx.navigateTo({
    url: '/pages/selecStaffDetail/selecStaffDetail?staffDetail=' + encodeURIComponent(JSON.stringify(value)),
  })
},
//会员开卡
// openCard(){
//   let shopId=app.globalData.shopId;
//   let vipId=this.data.selectId;
//   let shopAccountId=this.data.staffId;
//   let selectIndex=this.data.selectIndex;

//   if(!(selectIndex || selectIndex === 0)){
//     wx.showToast({
//       title: '请正确选择跟单员工',
//       icon:'none'
//     })
//     return 
//   }
//   this.hideModal()
//   console.log(shopAccountId);
  }
})
